package com.chaoyong.higo.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.chaoyong.higo.R;
import com.chaoyong.higo.base.BaseActivity;
import com.fanwei.sdk.api.PaySdk;
import com.tencent.mm.sdk.openapi.IWXAPI;
import com.tencent.mm.sdk.openapi.WXAPIFactory;

public class StartActivity extends BaseActivity {

	private boolean opened;
	private ImageView start_img;
	
	private static final String APP_ID = "wxd13d827c27bcd2a9";
	
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public int layoutResID() {
		// TODO Auto-generated method stub
		PaySdk.init(this, PaySdk.PORTRAIT);
		/*api = WXAPIFactory.createWXAPI(this, APP_ID, true);
		api.registerApp(APP_ID);*/
		return R.layout.activity_start;
	}

	@Override
	public void findView() {
		start_img = (ImageView) findViewById(R.id.start_img);
		start_img.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				showToast("不要着急嘛！人家还没有准备好~~~");
			}
		});
		opened = getSharedPreferences("opened", Context.MODE_PRIVATE).getBoolean("opened", false);
		new Handler().postDelayed(new Runnable() {
			
			@Override
			public void run() {
				// TODO Auto-generated method stub
				if(opened){
					startActivity(new Intent(StartActivity.this, MainActivity.class));
					finish();
				}else{
					startActivity(new Intent(StartActivity.this, SplashActivity.class));
					finish();
				}
				
			}
		}, 2000);
	}

	@Override
	public void init() {
		// TODO Auto-generated method stub
		
	}
	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		
		return false;
	}

}
